﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ERPStore.Exporter.Reporting.Models
{
    public class OrderCartReport 
    {
        private ERPStore.Models.OrderCart m_OrderCart;

        public OrderCartReport(ERPStore.Models.OrderCart inner)
        {
            this.m_OrderCart = inner;
        }

   		/// <summary>
		/// Numéro interne du panier
		/// </summary>
		/// <value>The id.</value>
		public int? Id 
        { 
            get
            {
                return m_OrderCart.Id;
            }
        }
		/// <summary>
		/// Code du panier généralement un GUID
		/// </summary>
		/// <value>The code.</value>
		public string Code
        { 
            get
            {
                return m_OrderCart.Code;
            }
        }

		/// <summary>
		/// Date de création du panier
		/// </summary>
		/// <value>The creation date.</value>
		public DateTime CreationDate
        { 
            get
            {
                return m_OrderCart.CreationDate;
            }
        }

		/// <summary>
		/// Identifiant interne du client s'il est identifié
		/// </summary>
		/// <value>The customer id.</value>
		public int? CustomerId
        { 
            get
            {
                return m_OrderCart.CustomerId;
            }
        }

		/// <summary>
		/// Identitifiant du visiteur
		/// </summary>
		/// <value>The visitor id.</value>
		public string VisitorId
        { 
            get
            {
                return m_OrderCart.VisitorId;
            }
        }

		/// <summary>
		/// Message à ajouter à la commande par l'utilisateur
		/// </summary>
		/// <value>The message.</value>
		public string Message
        { 
            get
            {
                return m_OrderCart.Message;
            }
        }

		/// <summary>
		/// L'utlisateur peut ajouter un code à lui pour retrouver plus tard celui ci dans la commande
		/// </summary>
		/// <value>The customer document reference.</value>
		public string CustomerDocumentReference
        { 
            get
            {
                return m_OrderCart.CustomerDocumentReference;
            }
        }


		/// <summary>
		/// Mode de reglement selectionné pour la commande
		/// </summary>
		/// <value>The payment mode.</value>
		public string PaymentModeName 
        { 
            get
            {
                return m_OrderCart.PaymentModeName ;
            }
        }


		/// <summary>
		/// L'utilisateur accepte les conditions générales de vente
		/// </summary>
		/// <value><c>true</c> if [accept condition]; otherwise, <c>false</c>.</value>
		public bool AcceptCondition
        { 
            get
            {
                return m_OrderCart.AcceptCondition;
            }
        }


		/// <summary>
		/// Accepte les livraisons partielles sur la commande
		/// </summary>
		/// <value>
		/// 	<c>true</c> if [allow partial delivery]; otherwise, <c>false</c>.
		/// </value>
		public bool AllowPartialDelivery
        { 
            get
            {
                return m_OrderCart.AllowPartialDelivery;
            }
        }


		/// <summary>
		/// Ce panier est un cadeau
		/// </summary>
		/// <value>
		/// 	<c>true</c> if this instance is present; otherwise, <c>false</c>.
		/// </value>
		public bool IsPresent
        { 
            get
            {
                return m_OrderCart.IsPresent;
            }
        }

		#region Totals

		/// <summary>
		/// Montant total HT du panier sans l'eco participation
		/// </summary>
		/// <value>The total.</value>
		public decimal Total
        { 
            get
            {
                return m_OrderCart.Total;
            }
        }

		/// <summary>
		/// Montant total brut HT comprenant les tarifs catalogue 
		/// </summary>
		public decimal GrossTotal
		{
			get
			{
				return m_OrderCart.GrossTotal;
			}
		}



		/// <summary>
		/// Montant total TTC du panier sans l'eco participation
		/// </summary>
		/// <value>The total with tax.</value>
		public decimal TotalWithTax 
        { 
            get
            {
                return m_OrderCart.TotalWithTax;
            }
        }



		/// <summary>
		/// Montant total ht de l'eco participation
		/// </summary>
		/// <value>The recycle total.</value>
		public decimal RecycleTotal
        { 
            get
            {
                return m_OrderCart.RecycleTotal;
            }
        }


        /// <summary>
		/// Montant total de la tva de l'eco participation
		/// </summary>
		/// <value>The recycle tax total.</value>
		public decimal RecycleTaxTotal
        { 
            get
            {
                return m_OrderCart.RecycleTaxTotal;
            }
        }


        /// <summary>
		/// Montant total ttc de l'eco participation
		/// </summary>
		/// <value>The recycle total with tax.</value>
		public decimal RecycleTotalWithTax 
        { 
            get
            {
                return m_OrderCart.RecycleTotalWithTax;
            }
        }


        /// <summary>
		/// Montant total ht du panier y compris l'eco participation
		/// </summary>
		/// <value>The grand total.</value>
		public decimal GrandTotal 
        { 
            get
            {
                return m_OrderCart.GrandTotal;
            }
        }


        /// <summary>
		/// Montant total de la tva y compris avec l'eco participation
		/// </summary>
		/// <value>The grand tax total.</value>
		public decimal GrandTaxTotal
        { 
            get
            {
                return m_OrderCart.GrandTaxTotal;
            }
        }


        /// <summary>
		/// Montant total ttc du panier y compris avec l'eco participation
		/// </summary>
		/// <value>The grand total with tax.</value>
		public decimal GrandTotalWithTax
        { 
            get
            {
                return m_OrderCart.GrandTotalWithTax;
            }
        }

        /// <summary>
        /// Montant total du port de livraison TTC
        /// </summary>
        /// <value>The shipping fee total with tax.</value>
        public decimal ShippingFeeTotal
        {
            get
            {
                return m_OrderCart.ShippingFee.Total;
            }
        }


		/// <summary>
		/// Montant total du port de livraison TTC
		/// </summary>
		/// <value>The shipping fee total with tax.</value>
		public decimal ShippingFeeTotalWithTax
        { 
            get
            {
                return m_OrderCart.ShippingFeeTotalWithTax;
            }
        }


        /// <summary>
		/// Montant de la remise globale en pourcentage
		/// </summary>
		/// <value>The discount.</value>
		public double Discount
        { 
            get
            {
                return m_OrderCart.Discount;
            }
        }

		/// <summary>
		/// Montant global de la remise
		/// </summary>
		/// <value>The global discount.</value>
		public decimal DiscountTotal
		{
			get
			{
				return m_OrderCart.DiscountTotal;
			}
		}


		/// <summary>
		/// Montant du taux de taxe sur la remise globale
		/// </summary>
		/// <value>The discount total tax rate.</value>
		public decimal DiscountTotalWithTax
		{
			get
			{
				return m_OrderCart.DiscountWithTaxTotal;
			}
		}

		public decimal TotalWithoutDiscountByItem
		{
			get
			{
				return m_OrderCart.TotalWithoutDiscountByItem;
			}
		}

		public decimal TotalWithDiscount
		{
			get
			{
				return m_OrderCart.TotalWithDiscount;
			}
		}

		public decimal ItemsDiscountTotal
		{
			get
			{
				return m_OrderCart.ItemsDiscountTotal;
			}
		}


		#endregion


        public string RecipientName { get; set; }

        public string Street { get; set; }

        public string ZipCode { get; set; }

        public string City { get; set; }

        public string CountryName { get; set; }

        public string Comment { get; set; }

        public string FullAddress
        {
            get
            {
                return Street + System.Environment.NewLine + ZipCode + " " + City + " " + CountryName;
            }
        }

        public string CartCode
        {
            get
            {
                return string.Format("CRT{0:000000}", this.Id);
            }
        }

    }
}
